'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DI_LINK_SPECTYPE 3DEVINFO "Mar 22, 2004"
.SH NAME
di_link_spectype, di_link_to_lnode \- return libdevinfo link information
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-ldevinfo\fR [ \fIlibrary\fR\&.\|.\|. ]
#include <libdevinfo.h>

\fBint\fR \fBdi_link_spectype\fR(\fBdi_link_t\fR \fIlink\fR);
.fi

.LP
.nf
\fBdi_lnode_t\fR \fBdi_link_to_lnode\fR(\fBdi_link_t\fR \fIlink\fR, \fBuint_t\fR \fIendpoint\fR);
.fi

.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIlink\fR\fR
.ad
.RS 12n
A handle to a link.
.RE

.sp
.ne 2
.na
\fB\fIendpoint\fR\fR
.ad
.RS 12n
specifies the endpoint of the link, which should correspond to either
\fBDI_LINK_TGT\fR or \fBDI_LINK_SRC\fR
.RE

.SH DESCRIPTION
.sp
.LP
The \fBdi_link_spectype()\fR function returns libdevinfo link information.
.sp
.LP
The \fBdi_link_to_lnode()\fR function takes a link specified by \fIlink\fR and
returns the lnode corresponding to the link endpoint specified by
\fIendpoint\fR.
.SH RETURN VALUES
.sp
.LP
The \fBdi_link_spectype()\fR function returns the spectype parameter flag that
was used to open the target device of a link, either \fBS_IFCHR\fR or
\fBS_IFBLK\fR.
.sp
.LP
Upon successful completion, \fBdi_link_to_lnode()\fR returns a handle to an
lnode. Otherwise, \fBDI_LINK_NIL\fR is returned and \fBerrno\fR is set to
indicate the error.
.SH ERRORS
.sp
.LP
The \fBdi_link_to_lnode()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
An argument is invalid.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR di_init (3DEVINFO),
.BR libdevinfo (3LIB),
.BR attributes (7)
